package com.lyz.dataStructure.考研上机编程题;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 20:17
 * @Description:
 **/

import java.util.Arrays;
import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/9/19 20:17
 *@Description:
 **/

public class 中位数 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            int n = sc.nextInt();
            if(n == 0) break;
            int[] arr = new int[n];
            for(int i =0;i<n;i++){
                arr[i] = sc.nextInt();
            }
            Arrays.sort(arr);
            int res = 0;
            if((n & 1) == 1){
                res = arr[n/2];
            }else{
                res = (arr[n/2]+arr[n/2-1]) / 2;
            }
            System.out.println(res);
        }
        sc.close();
    }

    public static  int returnNum(int[] arr){
        return 0;
    }
}
